<extend name="Public:base" />
<block name="btitle"><title>人才库</title> </block>
<block name="bcontainer">
    <div class="page-wrapper" id="main">
        <div class="container">
            <div class="cart-list" id="divContainer">
                <volist name='rencai' id='vo'>
                    <a href="{:U('/Index/rencai2')}" class="cart-item">
                        <div class="user-avatar">
                            <img src="__APP__/{:toTalentPhoto($vo['photo'],$vo['utype'])}" class="img-responsive" alt="" />
                        </div>
                        <div class="display-ellipsis">
                            <strong class="work-position">{$vo.job}</strong>&nbsp;<span class="work-years">{$vo.exp}年</span>
                        </div>
                        <div class="display-ellipsis">
                            <span class="user-name">{$vo.nickname}</span>
                            <span class="talnet-gender">
                                <i class="fa fa-<if condition=" $vo['gender'] eq 1">mars<elseif condition="$vo['gender'] eq 2" />venus<elseif condition="$vo['gender'] eq 0" />genderless</if>"></i>
                            </span>
                            <span class="user-address ">{$vo.address}</span>
                        </div>
                        <div class="user-intro">
                            <strong>技能描述：</strong><if condition="$vo.jineng heq 0">{$vo.jineng|textFilter=###,1}<elseif condition="$vo.jineng eq ''" />未填写<else />{$vo.jineng|nl2br}</if>
                        </div>
                    </a>
                </volist>
            </div>
            <br />
            <div class="load-more"><i class="fa fa-angle-double-down"></i>&nbsp;&nbsp;下拉加载更多</div>
            <br />
            <br />
            <br />
        </div>
    </div>
</block>
<block name="bfooterscript">
    <script type="text/x-kendo-template" id="tplCartItem">
        <a href="{:U('/Index/rencai2')}" class="cart-item">
            <div class="user-avatar">
                <img src="__APP__/#:photo#" class="img-responsive" alt="" />
            </div>
            <div class="display-ellipsis">
                <strong class="work-position">#:job#</strong>&nbsp;<span class="work-years">#:exp#年</span>
            </div>
            <div class="display-ellipsis">
                <span class="user-name">#:nickname#</span>
                <span class="talnet-gender">
                    #if(gender==1){#
                    <i class="fa fa-mars"></i>
                    #}else if(gender==2){#
                    <i class="fa fa-venus"></i>
                    #}else{#
                    <i class="fa fa-genderless"></i>
                    #}#
                </span>
                <span class="user-address ">#:address#</span>
            </div>
            <div class="user-intro">
                <strong>技能描述：</strong>#:jineng==null || jineng==""?"未填写":jineng#
            </div>
        </a>
    </script>
    <script type="text/javascript" src="/Publicm/scripts/kendo.core.min.js"></script>
    <script type="text/javascript">
        var page = 2;
        var loading = false;
        var totalpage = 100;

        $(document).ready(function () {

            //$('#divContainer').load(server, { 'page': page }, function () { page++; $('.animation_image').hide(); });

            $(window).scroll(function () {

                if ($(window).scrollTop() + $(window).height() == $(document).height()) {
                    if (page <= totalpage && loading == false) {
                        loading = true;
                        $('.load-more').hide();
                        var server = "{:U('/Index/rencai_ajax', '', '')}-p-" + page;
                        $.get(server, {}, function (data) {
                            if (data.rencai && data.rencai.length) {
                                var tpl = kendo.template($("#tplCartItem").html());
                                var html = kendo.render(tpl, data.rencai);
                                $("#divContainer").append($(html).css("opacity", 0));
                                $("#divContainer .cart-item").animate({ opacity: 1 }, 500);
                            } else {
                                totalpage = page;
                            }
                            page++;
                            $('.load-more').show();
                            loading = false;

                        }, "json").fail(function (xhr, ajaxOptions, thrownError) {
                            alert(thrownError); //alert with HTTP error
                            $('.load-more').show();
                            loading = false;
                        });
                    }
                    if (page > totalpage) {
                        $('.load-more').text("已经没有数据了");
                    }
                }
            });
        });
    </script>

</block>